# Include the directory itself as a path to include directories
set( CMAKE_INCLUDE_CURRENT_DIR ON )

# Add requirements for external libraries
find_package( SDL REQUIRED )
find_package( SDL_mixer REQUIRED )
find_package( Lua51 REQUIRED )
include_directories( ${SDL_INCLUDE_DIR} ${SDLMIXER_INCLUDE_DIR} ${LUA_INCLUDE_DIR} )

# Create a variable containing all .cpp files
file( GLOB pl_sdl_SOURCES *.cpp )

# Create a variable containing all .h files
file( GLOB pl_sdl_HEADERS *.h )

# Create a library for this module
add_library( pl_sdl ${pl_sdl_SOURCES} ${pl_sdl_HEADERS} ${pl_sdl_LUA_TGTS} )

# Set up other dependencies
target_link_libraries( pl_sdl ${CMAKE_DL_LIBS} )
target_link_libraries( pl_sdl ${SDL_LIBRARY} ) 
target_link_libraries( pl_sdl ${SDLMIXER_LIBRARY} )
target_link_libraries( pl_sdl ${LUA_LIBRARIES} ) 
target_link_libraries( pl_sdl core )

# Set up installation targets
install( FILES ${pl_sdl_LUA_TGTS} DESTINATION bin/sdl )
